#pragma warning(disable:4267)
#pragma warning(disable:4996)
#pragma warning(disable:6031)
#pragma warning(disable:6011)

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

namespace Y190715_e01{
int main();

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>

#define MAXN 10
int N;
char charPos[MAXN];
char s[MAXN] = "";

void permutation(int k) {
	int j;

	if (k == N) {
		printf("%s\n", charPos);
		return;
	}
	for (int i = 0; i < N; i++) {
		for (j = 0; j < k; j++) {
			if (charPos[j] == s[i]) {
				break;
			}
		}
		if (j == k){
			charPos[k] = s[i];
			permutation(k + 1);
		}
	}
}

int main() {
	//ec87a4caa112c229f67ae56e5b4848c37fa1e70c8f8b332fa092011326acd5a7
	scanf("%s", s);
	N = strlen(s);
	permutation(0);
	return 0;
}

}

int main_Y190715_e01() {
	return Y190715_e01::main();
}
